package net.interest.curation.model;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Datastore;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;

@Model
public class User implements Serializable {

    public static final String SESSION_USER_ATTR_NAME = "user";

    @Attribute(primaryKey = true)
    private Key key;
    
    @Attribute
    private String email;

    /**
     * Returns the key.
     *
     * @return the key
     */
    public Key getKey() {
        return key;
    }
    /**
     * Sets the key.
     *
     * @param key
     *            the key
     */
    public void setKey(Key key) {
        this.key = key;
    }


    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public static User createUser(){
        User user = new User();
        Datastore.put(user);

        ScrapBook scrapBook = new ScrapBook();
        scrapBook.setName("趣味");
        scrapBook.getUserRef().setModel(user);
        Datastore.put(scrapBook);
        ScrapBook scrapBook2 = new ScrapBook();
        scrapBook2.setName("ビジネス");
        scrapBook2.getUserRef().setModel(user);
        Datastore.put(scrapBook2);
        ScrapBook scrapBook3 = new ScrapBook();
        scrapBook3.setName("マネー");
        scrapBook3.getUserRef().setModel(user);
        Datastore.put(scrapBook3);
        return user;
    }
    
}
